home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / satellit / vstsrc / rotcntrl.c < prev    next >
C/C++ Source or Header  |  1995-01-25  |  3KB  |  102 lines

  1. /*
  2.  * %W% %E% %U%  [EXTREL_1.2]
  3.  *
  4.  * VersaTrack Copyright (c) 1993, 1994 Siamack Navabpour. All Rights Reserved.
  5.  *
  6.  * Permission is hereby granted to copy, modify and distribute VersaTrack
  7.  * in whole, or in part, for educational, non-profit and non-commercial use
  8.  * only, free of charge or obligation, and without agreement, provided that
  9.  * all copyrights and restrictions noted herein are observed and followed, and
  10.  * additionally, that this and all other copyright notices listed herein
  11.  * appear unaltered in all copies and in all derived work.
  12.  *
  13.  * This notice shall not in any way void or supersede any of the other authors
  14.  * rights or privileges.
  15.  *
  16.  * VersaTrack IS PRESENTED FREE AND "AS IS", WITHOUT ANY WARRANTY OR SUPPORT.
  17.  * YOU USE IT AT YOUR OWN RISK. The author(s) shall not be liable for any
  18.  * direct, indirect, incidental, or consequential damage, loss of profits or
  19.  * other tangible or intangible losses or benefits, arising out of or related
  20.  * to its use. VersaTrack carries no warranty, explicit or implied, including
  21.  * but not limited to those of merchantablity and fitness for a particular
  22.  * purpose.
  23.  *
  24.  * Siamack Navabpour, 12342 Hunter's Chase Dr. Apt. 2114, Austin, TX 78729.
  25.  * sia@bga.com or sia@realtime.com.
  26.  */
  27.  
  28. #include <windows.h>
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31.  
  32. #include "vstdefs.h"
  33. #include "vsttype.h"
  34. #include "libxtrns.h"
  35.  
  36. BOOL
  37. RotatorControl(version, hwnd, sp, vp)
  38. int version;
  39. HWND hwnd;
  40. select_t *sp;
  41. void *vp;
  42. {
  43.     rotinfo_t *rp = (rotinfo_t *) vp;    
  44.     extern BOOL applaunch(HWND, char *, char *, char *);
  45.     if (version > VSTVERSION)
  46.         return FALSE;
  47.     return applaunch(hwnd, rp->rot_driver, "", rp->rot_name);
  48. }
  49.  
  50. BOOL
  51. RadioControl(version, hwnd, sp, vp)
  52. int version;
  53. HWND hwnd;
  54. select_t *sp;
  55. void *vp;
  56. {
  57.     radinfo_t *rp = (radinfo_t *) vp;
  58.     extern BOOL appaunch(HWND, char *, char *, char *);
  59.         
  60.     if (version > VSTVERSION)
  61.         return FALSE;
  62.         
  63.     return applaunch(hwnd, rp->rad_driver, "", rp->rad_name);
  64. }
  65.  
  66. static BOOL
  67. applaunch(hwnd, exename, argline, model)
  68. HWND hwnd; 
  69. char *exename;
  70. char *argline;
  71. char *model;
  72. {
  73.     PROCESS_INFORMATION  pinfo;
  74.     STARTUPINFO si;
  75.     char *cp;
  76.     char name[80];
  77.     BOOL r;
  78.     int error;
  79.     extern char *StrError(int);
  80.  
  81.     for (cp = (char *)&si; cp < ((char *)&si + sizeof si);)
  82.         *cp++ = 0;
  83.  
  84.     sprintf(name, "DEBUG CONSOLE (BELONGS TO %s IN %s)", model, exename);
  85.     si.lpTitle = name;
  86.     si.dwXSize = 200;
  87.     si.dwYSize = 100;
  88.     si.wShowWindow = SW_SHOWMINIMIZED;
  89.  
  90.     sprintf(tmpbuf,"%s %08x %s", exename, hwnd, argline);
  91.     r = CreateProcess(NULL, tmpbuf, NULL, NULL, FALSE, IDLE_PRIORITY_CLASS,
  92.         NULL, NULL, &si, &pinfo);
  93.  
  94.     if (r == FALSE) {
  95.         error = GetLastError();
  96.         sprintf(tmpbuf,"Unable to run %s: %s", exename, StrError(error));
  97.         usermsg(NULL, tmpbuf);
  98.         return FALSE;
  99.     }
  100.     return TRUE;
  101. }
  102.